﻿using System;
using Platformer_Example.Controller.Terrain;
using Transformable_Engine_v2.Engine.Graphics;
using Transformable_Engine_v2.Engine.Transformable_Math.Geometry;

namespace Platformer_Example.Content.Images.Player
{
    public class SpritesheetPlayer : SpriteSheetInstance
    {
        private static SpriteSheetInstance _instance;
        public static void LoadContent()
        {
            _instance = new SpritesheetPlayer();
        }
        public new static Sprite GetSprite(Enum textureName)
        {
            return _instance.GetSprite(textureName);
        }
        public static SpriteSheetInstance GetInstance()
        {
            return _instance;
        }

        public override string SpriteSheetPath
        {
            get
            {
                return "Content/Images/Player/Player.png";
            }
        }

        public enum IdleState
        {
            Idle,
            Carry,
            Throw,
            Hurt,
        }

        public enum WalkState
        {
            Walk0,
            Walk1,
            Walk2,
            Walk3,
            Walk4,
            Walk5,
            Carry0,
            Carry1,
            Carry2,
            Carry3,
            Carry4,
            Carry5,
            Throw,
        }

        public enum AttackState
        {
            Attack0,
            Attack1,
            Attack2,
            Attack3,
            Attack4,
            Attack5,
        }

        public enum PickupState
        {
            Pickup0,
            Pickup1,
            Pickup2,
            Pickup3,
        }

        public enum JumpState
        {
            Jump,
            Fall,
            JumpCarry,
            FallCarry,
            Throw,
        }

        public enum LadderState
        {
            Climb0,
            Climb1,
        }

        protected override void LoadSprites()
        {
            AddSprite(IdleState.Idle, new TE_Rectangle(0, 0, 1, 2));
            AddSprite(IdleState.Carry, new TE_Rectangle(1, 0, 1, 2));
            AddSprite(IdleState.Throw, new TE_Rectangle(2, 0, 1.25f, 2));
            AddEnumList<WalkState>(WalkState.Walk0, WalkState.Walk5, new TE_Rectangle(0, 2, 1, 2));
            AddEnumList<WalkState>(WalkState.Carry0, WalkState.Carry5, new TE_Rectangle(0, 4, 1, 2));

            AddEnumList<JumpState>(JumpState.Jump, JumpState.FallCarry, new TE_Rectangle(6, 2, 1, 2));
            AddSprite(JumpState.Throw, new TE_Rectangle(10, 2, 1, 2));
            AddEnumList<AttackState>(AttackState.Attack0, AttackState.Attack5, new TE_Rectangle(0, 6, 2, 2));

            AddEnumList<LadderState>(LadderState.Climb0, LadderState.Climb1, new TE_Rectangle(4.25f, 0, 1, 2));
            AddSprite(WalkState.Throw, new TE_Rectangle(6.25f, 0, 1.25f, 2));

            AddEnumList<PickupState>(PickupState.Pickup0, PickupState.Pickup3, new TE_Rectangle(0, 8, 1.5f, 2));
        }


    }
}